﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <link href="~/Content/Easy UI/themes/default/easyui.css" rel="stylesheet" />
    <link href="~/Content/Easy UI/themes/icon.css" rel="stylesheet" />@*图片*@
    <script src="~/Content/Easy UI/script/jquery-1.11.1.js"></script>
    <script src="~/Content/Easy UI/script/jquery.easyui.min.js"></script>
    <script src="~/Content/Easy UI/script/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#dg").datagrid({
                fitColumns: false,//使列自动展开，收缩到合适的Datagrid高度
                toolbar: "#tb",//toolbar:通过选择器指定的工具栏
                pagination: true,//自动生成分页工具  pagination：如果为true，则在Datagrid控件底部显示分页工具栏
                /* fit: true,*///当设置为true的时候面板大小将自适应父容器
                singleSelect: true,//如果为true则只能选择一行
                rownumbers: true,//如果为true则显示一个行号列
                url: "/Shops/getShops",//设置能够返回Json数据的Action所对应的路径
                columns: [[
                    { field: 'S_ID', title: '店铺编号', width: 130, align: "center", },
                    { field: 'S_Name', title: '店铺名称', width: 130, align: "center", },
                    { field: 'S_Category', title: '店铺类型', width: 130, align: "center", },
                    { field: 'S_ContactName', title: '联系人', width: 130, align: "center", },
                    { field: 'S_ContactTel', title: '联系电话', width: 150, align: "center", },
                    { field: 'S_Address', title: '地址', width: 270, align: "center", },
                    { field: 'S_Remark', title: '店铺评价', width: 170, align: "center", },
                    { field: 'S_IsHasSetAdmin', title: '备注', width: 130, align: "center", },
                    { field: 'S_CreateTime', title: '开店时间', width: 130, align: "center", }
                ]]
            })
            //多条件查询
            $(".selectlist").click(function () {
                $("#dg").datagrid("load", {
                    shopsname: $("#shopsname").val(),
                    shopsMen: $("#shopsMen").val(),
                    shopsHome: $("#shopsHome").val()
                })
            })
            //添加
            $(".insert").click(function () {
                $("#dlg").dialog({ width: 800, height: 800 }).dialog("setTitle", "新增").dialog("open");
                $("#frm1").attr("src", "/Shops/Add");
            })
            //修改
            $(".Up").click(function () {
                var row = $("#dg").datagrid("getSelected")
                if (row != null) {
                    $("#dlg").dialog({ width: 800, height: 800 }).dialog("setTitle", "修改").dialog("open");
                    $("#frm1").attr("src", "/Shops/Edit/" + row.S_ID);
                }
                else
                {
                    $.messager.alert("提示", "请选择需要编辑的行", "warning");
                }
            })
            //删除
            $(".Delete").click(function () {
                var row = $("#dg").datagrid("getSelected");
                if (row != null) {
                    $.post("/Shops/Delete", { S_ID: row.S_ID }, function (data) {
                        if (data.ResultStatus == 1) {
                            $.messager.alert("提示", data.Msg, "info");
                            $("#dg").datagrid("reload");
                        } else {
                            $.messager.alert("提示", data.Msg, "warning");
                        }
                    })

                } else {
                    $.messager.alert("提示", data.Msg, "warning");
                }
            })

            

        })
    </script>
</head>
<body>
    <div>
        <div>


            <div id="tb">
                <a id="btn" href="javascript:" class="easyui-linkbutton insert" data-options="iconCls:'icon-add'">新增</a>
                <a id="btn" href="javascript:" class="easyui-linkbutton Up" data-options="iconCls:'icon-edit'">修改</a>
                <a id="btn" href="javascript:" class="easyui-linkbutton Delete" data-options="iconCls:'icon-remove'">删除</a>
                <a id="btn" href="javascript:" class="easyui-linkbutton Give" data-options="iconCls:'icon-OK'">分配管理员</a>
                <br />
                店铺名称：<input id="shopsname" type="text" style="width:60px;height:10px;border:1px solid gray ;" />
                联系人：<input id="shopsMen" type="text" style="width:60px;height:10px;border:1px solid gray ;" />
                店铺地址：<input id="shopsHome" type="text" style="width:60px;height:10px;border:1px solid gray ;" />
                <a id="btn" href="javascript:" class="easyui-linkbutton selectlist" data-options="iconCls:'icon-search'">搜索</a>
            </div>

            <table class="easyui-datagrid" id="dg"></table>

            <div id="dlg" class="easyui-dialog" data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true">
                <iframe id="frm1" width="99%" height="99%" frameborder="0"></iframe>
            </div>
        </div>
    </div>
</body>
</html>

